<?php

// +----------------------------------------------------------------------
// | CatchAdmin
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2021 https://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/JaguarJack/catchadmin/blob/master/LICENSE.md )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------

return [
    /*
    |--------------------------------------------------------------------------
    | catch-admin 超级管理员
    |--------------------------------------------------------------------------
    |
    | 可以设置超级管理的用户 ID
    | 支持数组
    |
    |--------------------------------------------------------------------------
    */
    'super_admin' => 1,

    /*
    |--------------------------------------------------------------------------
    | catch-admin 请求允许
    |--------------------------------------------------------------------------
    |
    | 默认允许 GET 请求通过 RBAC 权限
    |
    |--------------------------------------------------------------------------
    */
    'request_allowed' => true,

    /*
    |--------------------------------------------------------------------------
    | catch-admin 模块设置
    |--------------------------------------------------------------------------
    |
    | 设置模块根目录
    | 设置模块的根命名空间
    | 设置模块默认生成的文件夹
    |
    |--------------------------------------------------------------------------
    */
    'module' => [
        'root' => 'modules',

        'namespace' => 'Modules',

        /**
         * 默认启动的模块
         */
        'default' => ['develop', 'user', 'common'],

        'default_dirs' => [
            'Http'.DIRECTORY_SEPARATOR,

            'Http'.DIRECTORY_SEPARATOR.'Requests'.DIRECTORY_SEPARATOR,

            'Http'.DIRECTORY_SEPARATOR.'Controllers'.DIRECTORY_SEPARATOR,

            'Models'.DIRECTORY_SEPARATOR,
        ],

        // 模块存储驱动
        // 默认使用文件驱动
        'driver' => [
            // currently, catchadmin support file and database
            // the default is driver
            'default' => 'file',

            // use database driver
            'table_name' => 'admin_modules',
        ],

        /**
         * 模块路由集合
         */
        'routes' => [],

        /**
         * 模块是否自动加载
         *
         * 如果设置成 true，模块会自动全部加载
         */
        'autoload' => env('CATCH_MODULE_AUTOLOAD', false),
    ],

    /*
    |--------------------------------------------------------------------------
    | catch-admin 响应
    |--------------------------------------------------------------------------
    */
    'response' => [
        // JSON 响应, 保证响应数据都是 json
        'always_json' => \Catch\Middleware\JsonResponseMiddleware::class,

        // 响应监听者
        // 监听[RequestHandled]事件
        'request_handled_listener' => \Catch\Listeners\RequestHandledListener::class,
    ],

   /*
   |--------------------------------------------------------------------------
   | 数据库 SQL 日志
   |--------------------------------------------------------------------------
   */
    'listen_db_log' => env('APP_DEBUG', true),

   /*
   |--------------------------------------------------------------------------
   | 管理员授权认证模型
   |--------------------------------------------------------------------------
   */
    'auth_model' => \Modules\User\Models\User::class,

   /*
   |--------------------------------------------------------------------------
   | 管理员授权 Guard
   |--------------------------------------------------------------------------
   */
    'auth' => 'admin',

   /*
   |--------------------------------------------------------------------------
   | 路由配置
   |--------------------------------------------------------------------------
   */
    'route' => [
        'prefix' => 'api',

        'middlewares' => [
            \Catch\Middleware\AuthMiddleware::class,
            \Catch\Middleware\JsonResponseMiddleware::class,
        ],
    ],

   /*
   |--------------------------------------------------------------------------
   | 前端 Vue 视图文件夹路径
   |
   | 如果不设置，将不会生成相关的 Vue 文件
   |--------------------------------------------------------------------------
   */
    'views_path' => base_path('web'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR),


   /*
   |--------------------------------------------------------------------------
   | 开启系统接口日志分析
   |
   | 接口日志依赖 Redis，提高性能
   |--------------------------------------------------------------------------
   */
    'system_api_log' => env('CATCH_SYSTEM_API_LOG', false),
];
